Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SDL2 Renderer backend #193

Merged
merged 4 commits into from
Dec 15, 2023
Merged

Conversation

jship
Copy link
Contributor

@jship jship commented Dec 14, 2023

Closes #191. Here is a gif showing the added example program using the SDL2 renderer:

sdlrenderer

There are a couple stray commits included that add a withCloseableWindow variant and framerate as the SDL2 Renderer example uses these bits. Let me know if there is a preference on splitting those out into separate PRs.

@dpwiz
Copy link
Member

dpwiz commented Dec 14, 2023

#error This backend requires SDL 2.0.17+ because of SDL_RenderGeometry() function

Hm... This prompts us to use a distinct flag for the renderer. Something like sdl-renderer (default=true, manual=false).
The Hackage, Stackage and a bunch of LTS distros (ubuntu 20.04 still on 2.0.10) don't have it.

@jship
Copy link
Contributor Author

jship commented Dec 14, 2023

Nice catch! 84ae150 has the new flag.

@@ -94,6 +94,15 @@ flag sdl
manual:
True

flag sdl-renderer
description:
Enable SDL Renderer backend (requires the SDL_RenderGeometry function available in SDL 2.0.18+).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ImGui preprocessor error calls for 2.0.17+, but I opted for 2.0.18+ here as that's when the official docs and release notes indicate SDL_RenderGeometry was added.

My understanding is that SDL uses the odd version numbers for releases that might not be proven to be stable, so it may likely have been added in 2.0.17, but it seems users won't find much in the way of documentation for that version, so 2.0.18+ will hopefully avoid confusion.

@dpwiz dpwiz merged commit 4d1c66e into haskell-game:main Dec 15, 2023
1 check passed
@jship jship deleted the sdl2-renderer branch December 15, 2023 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SDL] Add ImGui functions that use the SDL2 Renderer
2 participants